﻿#region
/* ===============================================
 * 作者：guopeng           时间：2012/4/2 20:02:57
 * 
 * 
 * 类描述：
 * 
 * 
 * =============================================== */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ueEngine.Biz.Inf.Entities;
using ueEngine.Biz.Inf.LogicEntity.SupportData;
using ueEngine.Biz.Inf.Entities.DBSupport;


namespace ueEngine.Biz.Inf.LogicEntity
{
    public class RecruitSheetModel : IAccessible<RecruitSheet,RecruitSheetModel>
    {
        #region self
        public int Id { get; set; }
        /// <summary>
        /// 招募标题
        /// </summary>
        public string Caption { get; set; }
        /// <summary>
        /// 联系人
        /// </summary>
        public string Contact { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string ContactPhone { get; set; }
        /// <summary>
        /// 工作区域
        /// </summary>
        public AreaCode WorkArea { get; set; }
        /// <summary>
        /// 详细地址
        /// </summary>
        public string WorkAddress { get; set; }
        /// <summary>
        /// 代理人用户名
        /// </summary>
        public string Recruiter { get; set; }
        /// <summary>
        /// 被代理企业Id
        /// </summary>
        public int DepositCompanyId { get; set; }
        /// <summary>
        /// 招募类型分类
        /// </summary>
        public RecruitSheetType RecruitType { get; set; }
        /// <summary>
        /// 子类
        /// </summary>
        public RecruitSheetSubject RecruitSubject { get; set; }
        /// <summary>
        /// 发布日期
        /// </summary>
        public DateTime PublishDate { get; set; }

        /// <summary>
        /// 执行该委托的客户经理（如果有）
        /// </summary>
        public string CustomerManager { get; set; }
        /// <summary>
        /// 以此创建模板
        /// </summary>
        public bool Templete { get; set; }
        /// <summary>
        /// 是否已经审核
        /// </summary>
        public bool IsVerify { get; set; }
        /// <summary>
        /// 是否启用邮件通知
        /// </summary>
        public bool EnableEmail { get; set; }
        /// <summary>
        /// 用以接收简历的邮箱
        /// </summary>
        public string ReceiveEmail { get; set; }

        public string QQ { get; set; }

        public DateTime Refresh { get; set; }

        public RecruitmentSource Source { get; set; }

        public string MapSetting { get; set; }
        #endregion

        #region postions
        public List<PositionModel> Positions { get; set; }
        #endregion

        #region depositCompany
        public DepositCompanyModel DepositCompany { get; set; }
        #endregion

        #region Agent
        public MemberModel AgentInfo { get; set; }
        #endregion
        protected override void Covariant(RecruitSheet dbModel)
        {
            this.CustomerManager = dbModel.CustomerManager;
            this.Id = dbModel.Id;
            this.PublishDate = dbModel.PublishDate;
            this.Recruiter = dbModel.Recruiter;
            this.RecruitSubject = (RecruitSheetSubject)dbModel.RecruitSubject;
            this.RecruitType = (RecruitSheetType)dbModel.RecruitType;
            this.DepositCompanyId = dbModel.DepositCompanyId;
            this.Caption = dbModel.Caption;
            this.Templete = dbModel.Templete;
            this.Contact = dbModel.Contact;
            this.ContactPhone = dbModel.ContactPhone;
            this.WorkAddress = dbModel.WorkAddress;
            this.WorkArea = (AreaCode)dbModel.WorkArea;
            this.IsVerify = dbModel.IsVerify;
            this.EnableEmail = dbModel.EnableEmail;
            this.ReceiveEmail = dbModel.ReceiveEmail;
            this.QQ = dbModel.QQ;
            this.Refresh = dbModel.Refresh;
            this.Source = (RecruitmentSource)dbModel.Source;
            this.MapSetting = dbModel.MapSetting;
        }
        protected override RecruitSheet Inverter(RecruitSheetModel model)
        {
            return new RecruitSheet()
            {
                CustomerManager = model.CustomerManager,
                Id = model.Id,
                PublishDate = model.PublishDate,
                Recruiter = model.Recruiter,
                RecruitSubject = (int)model.RecruitSubject,
                RecruitType = (int)model.RecruitType,
                DepositCompanyId = model.DepositCompanyId,
                Caption = model.Caption,
                WorkArea = (int)model.WorkArea,
                WorkAddress = model.WorkAddress,
                Templete = model.Templete,
                Contact = model.Contact,
                ContactPhone = model.ContactPhone,
                IsVerify = model.IsVerify,
                EnableEmail = model.EnableEmail,
                ReceiveEmail = model.ReceiveEmail,
                QQ = model.QQ,
                Refresh = model.Refresh,
                Source = (int)model.Source,
                MapSetting = model.MapSetting
            };
        }
        //public override RecruitSheetModel Element(System.Linq.Expressions.Expression<Func<RecruitSheet, bool>> where)
        //{
        //    Covariant(new RecruitSheet().Get(where));
        //    return this;
        //}
        //public override List<TResult> Elements<TResult>(System.Linq.Expressions.Expression<Func<RecruitSheet, bool>> where, System.Linq.Expressions.Expression<Func<RecruitSheet, TResult>> select)
        //{
        //    using (Context ctx = new Context())
        //    {
        //        return ctx.RecruitSheet.Where(where).Select(select).ToList();
        //    }
        //}
    }
}
